package com.orange.core.util;

import java.math.BigDecimal;
import java.time.format.DateTimeFormatter;

public interface Constants {

    // 启用，是
    int POSITIVE = 1;
    // 禁用，否
    int NEGATIVE = 0;

    // 已删除
    int DELETED = 1;
    // 未删除
    int UNDELETED = 0;

    String COUPON_PREFIX = "C";
    String CREDIT_ORDER_PREFIX = "P";
    String USER_PREFIX = "U";

    String TOKEN_KEY = "token";
    String ADMIN_TOKEN_REDIS_KEY = "orange:security:admin:token:";
    String USER_TOKEN_REDIS_KEY = "orange:security:user:token:";

    // 管理员token前缀
    char ADMIN_TOKEN_PREFIX = 'a';
    // 用户微信小程序登录token前缀
    char USER_MINI_TOKEN_PREFIX = 'm';

    String ADMIN_SIGN_IN_PATH = "/auth/signIn";
    String USER_WX_MINI_SIGN_IN_PATH = "/auth/mpSignIn";
    String SIGN_OUT_PATH = "/auth/signOut";

    // 管理员登录token有效期：1天
    long ADMIN_MAX_INACTIVE_INTERVAL = 86400;
    // 管理员登录记住我token有效期：7天
    long ADMIN_REMEMBER_ME_INACTIVE_INTERVAL = 604800;
    // 小程序登录token有效期：10年
    long WX_MINI_MAX_INACTIVE_INTERVAL = 86400 * 365 * 10;

    String ROLE_PREFIX = "ROLE_";

    // 创建者字段名
    String CREATOR_FIELD = "createBy";
    // 更新者字段名
    String MODIFIER_FIELD = "updateBy";

    long DEFAULT_PAGE_SIZE = 20;
    long MAX_PAGE_SIZE = 10000;

    String MOBILE_PHONE_RGX = "1[3-9][0-9]{9}";
    String EMAIL_RGX = ".+@.+(\\..+){1,2}";

    String APPLICATION_JSON_UTF8_VALUE = "application/json;charset=UTF-8";

    String PASSWORD_RGX = "^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)[A-Za-z\\d@]{%s,%s}$";

    String DEFAULT_DATE_TIME_FORMAT = "yyyy-MM-dd HH:mm:ss";
    DateTimeFormatter DEFAULT_DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern(Constants.DEFAULT_DATE_TIME_FORMAT);
    String DEFAULT_DATE_FORMAT = "yyyy-MM-dd";
    DateTimeFormatter DEFAULT_DATE_FORMATTER = DateTimeFormatter.ofPattern(Constants.DEFAULT_DATE_FORMAT);

    BigDecimal THREE = new BigDecimal(3);
    BigDecimal ONE_HUNDRED = new BigDecimal(100);
}
